﻿/*======================================*\
* Author: Vincent
* LastModifyUser: Vincent
* Description:  
* CreateTime： 2012-05
* Remark:  
\*======================================*/

using System;
using ZLDC.GenericFrame.Entity.Attributes;
using ZLDC.GenericFrame.Entity;

namespace AppCode.DbDTO
{
    /// <summary>
    /// 表信息的DTO
    /// </summary>
    [Serializable]
    [TableProperty(DefaultOrderby = " Desc", PrimaryKey = "", DbType = DbTypeEnum.SqlServer, ConnAppKey="DefaultDb", TableName = "View_GetDbTableInfo")]
    public class TableInfo : BaseEntity
    {
        public TableInfo()
        { }
        #region Model
        private string _tablename;
        private int _columnnum;
        private string _columnname;
        private string _isidentity;
        private string _isprimarykey;
        private string _columntype;
        private int _bytesize;
        private int _alowlength;
        private int _decimalsize;
        private string _isalownull;
        private string _defaultvalue;
        private string _columnremark;
        /// <summary>
        /// 表名
        /// </summary>
        [ColumnProperty(ColumnName = "TableName")]
        public string TableName
        {
            set
            {
                object oldValue = _tablename;
                _tablename = value;
                if ((value == null) || (!value.Equals(oldValue)))
                {
                    this.OnPropertyChanged("TableName", _tablename, oldValue);
                    this.OnPropertyMappingChanged("TableName", _tablename, oldValue);
                }

            }
            get { return _tablename; }
        }
        /// <summary>
        /// 字段序号
        /// </summary>
        [ColumnProperty(ColumnName = "ColumnNum")]
        public int ColumnNum
        {
            set
            {
                object oldValue = _columnnum;
                _columnnum = value;
                {
                    this.OnPropertyChanged("ColumnNum", _columnnum, oldValue);
                    this.OnPropertyMappingChanged("ColumnNum", _columnnum, oldValue);
                }

            }
            get { return _columnnum; }
        }
        /// <summary>
        /// 字段名
        /// </summary>
        [ColumnProperty(ColumnName = "ColumnName")]
        public string ColumnName
        {
            set
            {
                object oldValue = _columnname;
                _columnname = value;
                if ((value == null) || (!value.Equals(oldValue)))
                {
                    this.OnPropertyChanged("ColumnName", _columnname, oldValue);
                    this.OnPropertyMappingChanged("ColumnName", _columnname, oldValue);
                }

            }
            get { return _columnname; }
        }
        /// <summary>
        /// 字段标记
        /// </summary>
        [ColumnProperty(ColumnName = "IsIdentity")]
        public string IsIdentity
        {
            set
            {
                object oldValue = _isidentity;
                _isidentity = value;

                this.OnPropertyChanged("IsIdentity", _isidentity, oldValue);
                this.OnPropertyMappingChanged("IsIdentity", _isidentity, oldValue);
            }
            get { return _isidentity; }
        }
        /// <summary>
        /// 是否主键
        /// </summary>
        [ColumnProperty(ColumnName = "IsPrimaryKey")]
        public string IsPrimaryKey
        {
            set
            {
                object oldValue = _isprimarykey;
                _isprimarykey = value;

                this.OnPropertyChanged("IsPrimaryKey", _isprimarykey, oldValue);
                this.OnPropertyMappingChanged("IsPrimaryKey", _isprimarykey, oldValue);
            }
            get { return _isprimarykey; }
        }
        /// <summary>
        /// 字段类型
        /// </summary>
        [ColumnProperty(ColumnName = "ColumnType")]
        public string ColumnType
        {
            set
            {
                object oldValue = _columntype;
                _columntype = value;
                if ((value == null) || (!value.Equals(oldValue)))
                {
                    this.OnPropertyChanged("ColumnType", _columntype, oldValue);
                    this.OnPropertyMappingChanged("ColumnType", _columntype, oldValue);
                }

            }
            get { return _columntype; }
        }
        /// <summary>
        /// 占用字节大小
        /// </summary>
        [ColumnProperty(ColumnName = "ByteSize")]
        public int ByteSize
        {
            set
            {
                object oldValue = _bytesize;
                _bytesize = value;
                //关于string,int,float只要 set就应该处理了
                this.OnPropertyChanged("ByteSize", _bytesize, oldValue);
                this.OnPropertyMappingChanged("ByteSize", _bytesize, oldValue);

            }
            get { return _bytesize; }
        }
        /// <summary>
        /// 字段类型允许的长度
        /// </summary>
        [ColumnProperty(ColumnName = "AlowLength")]
        public int AlowLength
        {
            set
            {
                object oldValue = _alowlength;
                _alowlength = value;
                {
                    this.OnPropertyChanged("AlowLength", _alowlength, oldValue);
                    this.OnPropertyMappingChanged("AlowLength", _alowlength, oldValue);
                }

            }
            get { return _alowlength; }
        }
        /// <summary>
        /// 小数位数
        /// </summary>
        [ColumnProperty(ColumnName = "DecimalSize")]
        public int DecimalSize
        {
            set
            {
                object oldValue = _decimalsize;
                _decimalsize = value;
                //关于string,int,float只要 set就应该处理了
                this.OnPropertyChanged("DecimalSize", _decimalsize, oldValue);
                this.OnPropertyMappingChanged("DecimalSize", _decimalsize, oldValue);

            }
            get { return _decimalsize; }
        }
        /// <summary>
        /// 字段是否允许为空
        /// </summary>
        [ColumnProperty(ColumnName = "IsAlowNull")]
        public string IsAlowNull
        {
            set
            {
                object oldValue = _isalownull;
                _isalownull = value;

                this.OnPropertyChanged("IsAlowNull", _isalownull, oldValue);
                this.OnPropertyMappingChanged("IsAlowNull", _isalownull, oldValue);
            }
            get { return _isalownull; }
        }
        /// <summary>
        /// 字段默认值
        /// </summary>
        [ColumnProperty(ColumnName = "DefaultValue")]
        public string DefaultValue
        {
            set
            {
                object oldValue = _defaultvalue;
                _defaultvalue = value;
                if ((value == null) || (!value.Equals(oldValue)))
                {
                    this.OnPropertyChanged("DefaultValue", _defaultvalue, oldValue);
                    this.OnPropertyMappingChanged("DefaultValue", _defaultvalue, oldValue);
                }

            }
            get { return _defaultvalue; }
        }
        /// <summary>
        /// 字段备注
        /// </summary>
        [ColumnProperty(ColumnName = "ColumnRemark")]
        public string ColumnRemark
        {
            set
            {
                object oldValue = _columnremark;
                _columnremark = value;
                if ((value == null) || (!value.Equals(oldValue)))
                {
                    this.OnPropertyChanged("ColumnRemark", _columnremark, oldValue);
                    this.OnPropertyMappingChanged("ColumnRemark", _columnremark, oldValue);
                }

            }
            get { return _columnremark; }
        }
        #endregion Model

    }
}
